/**
 *
 */
package com.androidnetframe.httputil;

import com.androidnetframe.requestbean.GlobalRequestBean;

/**
 * @author 何强 2015-9-10 封装一个真正的网络请求 成员名就是json文件名 注：
 *         在开发一个新的项目时，由于服务器端还没提供可以被访问的JavaBeanURL地址
 *         ，但我们又希望在UI界面上，执行一个真正的网络请求javaBean的动作。
 *         这个时候，我们可以发起一个真正的网络请求，当请求结果回来之后，我们不使用请求回来的数据，而是从磁盘中读取预先存放的json文件。
 */
public class EntryPageName {

//    测试服务器
//  public static final String globalRequest = "http://api.test.lolever.com/";
//    正式服务器
  public static final String globalRequest = "https://api.lolever.com/";
    /** http://api.lolever.com/ */
    /**
     * manager.lolever.com
     */
    /* 配置入口地址的常量 */
    public static final int orders = 1;
    public static final int login = 2;
    /*public static final int base = 9999;*/
    public static final int common = 10000;
    public static final int n1_a = 10001;
    public static final int n2_a = 10002;
    public static final int n3_a = 10003;
    public static final int n4_a = 10004;
    public static final int n5_a = 10005;
    public static final int n6_a = 10006;
    public static final int n7_a = 10007;
    public static final int n8_a = 10008;
    public static final int n9_a = 10009;
    /* 配置入口地址的常量 */

    public static boolean debug = true;
    public static GlobalRequestBean globalRequestBean = new GlobalRequestBean();

    public static String getURL(int str) {
        DebugEntryName.debugEntryName = null;
        DebugEntryName.realEntryName = null;
        //测试接口的根地址
        String baseUrl = "https://www.baidu.com/";
        //真实接口的根地址
        //baseUrl = "http://mapi.zgxcw.com/service/";

        if (globalRequestBean.getData() == null)
            return "";

        switch (str) {
            case 1:
                DebugEntryName.debugEntryName = "index";
                DebugEntryName.realEntryName = "order/orderlist";
                break;
            case 2:
                DebugEntryName.debugEntryName = "index";
                DebugEntryName.realEntryName = "login";
                break;
           /* case base:
                DebugEntryName.debugEntryName = "index";
                DebugEntryName.realEntryName = Constants.BASE;
                break;*/
            case common:
                DebugEntryName.debugEntryName = "index";
                DebugEntryName.realEntryName = globalRequestBean.getData().getCommon();
                break;
            case n1_a:
                DebugEntryName.debugEntryName = "index";
                DebugEntryName.realEntryName = globalRequestBean.getData().getN1_a();
                break;
            case n2_a:
                DebugEntryName.debugEntryName = "index";
                DebugEntryName.realEntryName = globalRequestBean.getData().getN2_a();
                break;
            case n3_a:
                DebugEntryName.debugEntryName = "index";
                DebugEntryName.realEntryName = globalRequestBean.getData().getN3_a();
                break;
            case n4_a:
                DebugEntryName.debugEntryName = "index";
                DebugEntryName.realEntryName = globalRequestBean.getData().getN4_a();
                break;
            case n5_a:
                DebugEntryName.debugEntryName = "index";
                DebugEntryName.realEntryName = globalRequestBean.getData().getN5_a();
                break;
            case n6_a:
                DebugEntryName.debugEntryName = "index";
                DebugEntryName.realEntryName = globalRequestBean.getData().getN6_a();
                break;
            case n8_a:
                DebugEntryName.debugEntryName = "index";
                DebugEntryName.realEntryName = globalRequestBean.getData().getN8_a();
                break;
            case n9_a:
                DebugEntryName.debugEntryName = "index";
                DebugEntryName.realEntryName = globalRequestBean.getData().getN9_a();
                break;
        }
        if (debug) {
            return baseUrl + DebugEntryName.debugEntryName + ".html";// 这里是测试用的
        } else {
            baseUrl = "";
            //Log.i("zhenshi", baseUrl + DebugEntryName.realEntryName);
            return baseUrl + DebugEntryName.realEntryName;// 真实网络
        }
    }

    public static class DebugEntryName {
        public static String debugEntryName;
        public static String realEntryName;
    }
}
